/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.commands;

import edu.wpi.first.wpilibj.templates.RobotMap;
import edu.wpi.first.wpilibj.templates.assets.ArmSwitchPair;

/**
 *
 * @author Jarrod Risley
 */
public class Ingest extends CommandBase {
    
    /*
     * Global Class Variables
     */
    private boolean isFinished = false;
    
    public Ingest() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        
        requires(shooter);
        requires(intake);
        
    } // end Ingest Constructor

    // Called just before this Command runs the first time
    protected void initialize() {
        System.out.println("Ingest command running.");
    } // end initialize

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        
        do {
            intake.intake(RobotMap.INTAKE_FRIZBEE);
            shooter.ingest();
        } while (!shooter.checkSwitch(2) || !shooter.checkTopSwitch(2));
        
        shooter.incrementDiscCount();
        isFinished = true;
        
    } // end execute

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return isFinished;
    } // end isFinished

    // Called once after isFinished returns true
    protected void end() {
        System.out.println("Ingest command ending");
    } // end end...lolz

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    } // end interrupted
    
} // end Ingest
